#include "BangoStatic.h"

QString BangoStatic::GetUserID()
{
    QString tempString;
    QSystemDeviceInfo* deviceInfo = new QSystemDeviceInfo();
    if (deviceInfo)
    {
        tempString = QCryptographicHash::hash(deviceInfo->imei().toAscii(), QCryptographicHash::Md5).toHex();
    }
    return tempString;
}

QString BangoStatic::GetOperatingSystemName()
{
    QString osString;

    osString += QString::fromLatin1(

    // Platform
    #ifdef Q_WS_MAC
        "Macintosh"
    #elif defined Q_WS_QWS
        "QtEmbedded"
    #elif defined Q_WS_MAEMO_5
        "Maemo"
    #elif defined Q_WS_MAEMO_6
        "MeeGo"
    #elif defined Q_WS_WIN
        "Windows"
    #elif defined Q_WS_X11
        "X11"
    #elif defined Q_OS_SYMBIAN
        "Symbian OS"
    #else
        "Unknown"
    #endif
    );

    return osString;
}

QString BangoStatic::GetOperatingSystemVersion()
{
    QSystemInfo systemInfo;

    return systemInfo.version(QSystemInfo::Os);
}

QString BangoStatic::GetUserAgent()
{

    QString firstPart;
    QString secondPart;
    QString thirdPart;
    QString languageName;
    QString appName;
    QString returnValue;

    firstPart += QString::fromLatin1("Mozilla/5.0 ("

    // Platform
    #ifdef Q_WS_MAC
        "Macintosh"
    #elif defined Q_WS_QWS
        "QtEmbedded"
    #elif defined Q_WS_MAEMO_5
        "Maemo"
    #elif defined Q_WS_MAEMO_6
        "MeeGo"
    #elif defined Q_WS_WIN
        "Windows"
    #elif defined Q_WS_X11
        "X11"
    #elif defined Q_OS_SYMBIAN
        "Symbian"
    #else
        "Unknown"
    #endif
    );

    // SSL support
#if !defined(QT_NO_OPENSSL)
    // we could check QSslSocket::supportsSsl() here, but this makes
    // OpenSSL, certificates etc being loaded in all cases were QWebPage
    // is used. This loading is not needed for non-https.
    firstPart += QString::fromLatin1("U; ");
    // this may lead to a false positive: We indicate SSL since it is
    // compiled in even though supportsSsl() might return false
#else
    firstPart += QString::fromLatin1("N; ");
#endif

#if defined Q_OS_SYMBIAN
        QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
        switch (symbianVersion) {
        case QSysInfo::SV_9_2:
            firstPart += QString::fromLatin1("OS/9.2");
            break;
        case QSysInfo::SV_9_3:
            firstPart += QString::fromLatin1("OS/9.3");
            break;
        case QSysInfo::SV_9_4:
            firstPart += QString::fromLatin1("OS/9.4");
            break;
        case QSysInfo::SV_SF_2:
            firstPart += QString::fromLatin1("/2");
            break;
        case QSysInfo::SV_SF_3:
            firstPart += QString::fromLatin1("/3");
            break;
        case QSysInfo::SV_SF_4:
            firstPart += QString::fromLatin1("/4");
        default:
            break;
        }
#endif

        firstPart += QString::fromLatin1("; ");

        // Operating system
#ifdef Q_OS_AIX
        firstPart += QString::fromLatin1("AIX");
#elif defined Q_OS_WIN32

        switch (QSysInfo::WindowsVersion) {
        case QSysInfo::WV_32s:
            firstPart += QString::fromLatin1("Windows 3.1");
            break;
        case QSysInfo::WV_95:
            firstPart += QString::fromLatin1("Windows 95");
            break;
        case QSysInfo::WV_98:
            firstPart += QString::fromLatin1("Windows 98");
            break;
        case QSysInfo::WV_Me:
            firstPart += QString::fromLatin1("Windows 98; Win 9x 4.90");
            break;
        case QSysInfo::WV_NT:
            firstPart += QString::fromLatin1("WinNT4.0");
            break;
        case QSysInfo::WV_2000:
            firstPart += QString::fromLatin1("Windows NT 5.0");
            break;
        case QSysInfo::WV_XP:
            firstPart += QString::fromLatin1("Windows NT 5.1");
            break;
        case QSysInfo::WV_2003:
            firstPart += QString::fromLatin1("Windows NT 5.2");
            break;
        case QSysInfo::WV_VISTA:
            firstPart += QString::fromLatin1("Windows NT 6.0");
            break;
         case QSysInfo::WV_WINDOWS7:
            firstPart += QString::fromLatin1("Windows NT 6.1");
            break;
         case QSysInfo::WV_CE:
            firstPart += QString::fromLatin1("Windows CE");
            break;
         case QSysInfo::WV_CENET:
            firstPart += QString::fromLatin1("Windows CE .NET");
            break;
         case QSysInfo::WV_CE_5:
            firstPart += QString::fromLatin1("Windows CE 5.x");
            break;
         case QSysInfo::WV_CE_6:
            firstPart += QString::fromLatin1("Windows CE 6.x");
            break;
        }

#elif defined Q_OS_DARWIN
#ifdef __i386__ || __x86_64__
        firstPart += QString::fromLatin1("Intel Mac OS X");
#else
        firstPart += QString::fromLatin1("PPC Mac OS X");
#endif

#elif defined Q_OS_BSDI
        firstPart += QString::fromLatin1("BSD");
#elif defined Q_OS_BSD4
        firstPart += QString::fromLatin1("BSD Four");
#elif defined Q_OS_CYGWIN
        firstPart += QString::fromLatin1("Cygwin");
#elif defined Q_OS_DGUX
        firstPart += QString::fromLatin1("DG/UX");
#elif defined Q_OS_DYNIX
        firstPart += QString::fromLatin1("DYNIX/ptx");
#elif defined Q_OS_FREEBSD
        firstPart += QString::fromLatin1("FreeBSD");
#elif defined Q_OS_HPUX
        firstPart += QString::fromLatin1("HP-UX");
#elif defined Q_OS_HURD
        firstPart += QString::fromLatin1("GNU Hurd");
#elif defined Q_OS_IRIX
        firstPart += QString::fromLatin1("SGI Irix");
#elif defined Q_OS_LINUX
#if !defined(Q_WS_MAEMO_5) && !defined(Q_WS_MAEMO_6)
#if defined(__x86_64__)
        firstPart += QString::fromLatin1("Linux x86_64");
#elif defined(__i386__)
        firstPart += QString::fromLatin1("Linux i686");
#else
        firstPart += QString::fromLatin1("Linux");
#endif
#endif
#elif defined Q_OS_LYNX
        firstPart += QString::fromLatin1("LynxOS");
#elif defined Q_OS_NETBSD
        firstPart += QString::fromLatin1("NetBSD");
#elif defined Q_OS_OS2
        firstPart += QString::fromLatin1("OS/2");
#elif defined Q_OS_OPENBSD
        firstPart += QString::fromLatin1("OpenBSD");
#elif defined Q_OS_OS2EMX
        firstPart += QString::fromLatin1("OS/2");
#elif defined Q_OS_OSF
        firstPart += QString::fromLatin1("HP Tru64 UNIX");
#elif defined Q_OS_QNX6
        firstPart += QString::fromLatin1("QNX RTP Six");
#elif defined Q_OS_QNX
        firstPart += QString::fromLatin1("QNX");
#elif defined Q_OS_RELIANT
        firstPart += QString::fromLatin1("Reliant UNIX");
#elif defined Q_OS_SCO
        firstPart += QString::fromLatin1("SCO OpenServer");
#elif defined Q_OS_SOLARIS
        firstPart += QString::fromLatin1("Sun Solaris");
#elif defined Q_OS_ULTRIX
        firstPart += QString::fromLatin1("DEC Ultrix");
#elif defined Q_OS_SYMBIAN
        QSysInfo::S60Version s60Version = QSysInfo::s60Version();
        switch (s60Version) {
        case QSysInfo::SV_S60_3_1:
            firstPart += QString::fromLatin1("Series60/3.1");
            break;
        case QSysInfo::SV_S60_3_2:
            firstPart += QString::fromLatin1("Series60/3.2");
            break;
        case QSysInfo::SV_S60_5_0:
            firstPart += QString::fromLatin1("Series60/5.0");
            break;
        case QSysInfo::SV_S60_5_1:
            firstPart += QString::fromLatin1("Series60/5.1");
            break;
        case QSysInfo::SV_S60_5_2:
            firstPart += QString::fromLatin1("Series60/5.2");
            break;
        case QSysInfo::SV_S60_None:
        case QSysInfo::SV_S60_Unknown:
        default:
            break;
        }
#elif defined Q_OS_UNIX
        firstPart += QString::fromLatin1("UNIX BSD/SYSV system");
#elif defined Q_OS_UNIXWARE
        firstPart += QString::fromLatin1("UnixWare Seven, Open UNIX Eight");
#else
        firstPart += QString::fromLatin1("Unknown");
#endif
        QSystemInfo sysInfo;
        QSystemDeviceInfo systemDeviceInfo;

        QString manufacturer = systemDeviceInfo.manufacturer();
        if (!manufacturer.isEmpty()) {
            if (!firstPart.endsWith("; "))
                firstPart += QString::fromLatin1("; ");
            firstPart += manufacturer;

            QString model = systemDeviceInfo.model();
            if (!model.isEmpty()) {
                firstPart += model;
            }

            QString modelVersion = sysInfo.version(QSystemInfo::Firmware);
            if (!modelVersion.isEmpty()) {
                firstPart += QString::fromLatin1("/");
                firstPart += modelVersion;
            }
        }

        // language is the split
        if (!firstPart.endsWith("; "))
            firstPart += QString::fromLatin1("; ");
        firstPart.squeeze();

        secondPart.reserve(150);
        secondPart += QString::fromLatin1(") ");

        // webkit/qt version
        secondPart += QString::fromLatin1("AppleWebKit/");
        secondPart += QTWEBKIT_VERSION_STR;
        secondPart += QString::fromLatin1(" (KHTML, like Gecko) ");
        secondPart.squeeze();

        thirdPart.reserve(150);
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
        thirdPart += QLatin1String(" Mobile Safari/");
#else
        thirdPart += QLatin1String(" Safari/");
#endif
        thirdPart += QTWEBKIT_VERSION_STR;

        thirdPart.squeeze();


    // Language
    languageName = QLocale().name();
    languageName.replace(QLatin1Char('_'), QLatin1Char('-'));

    // Application name/version
    appName = QCoreApplication::applicationName();
    if (!appName.isEmpty()) {
        QString appVer = QCoreApplication::applicationVersion();
        if (!appVer.isEmpty())
            appName.append(QLatin1Char('/') + appVer);
    } else {
        // Qt version
        appName = QString::fromLatin1("Qt/") + QString::fromLatin1(qVersion());
    }

    returnValue = firstPart + languageName + secondPart + appName + thirdPart;

    return returnValue;
}

bool BangoStatic::IsWifiConnection()
{
    bool isWifi = false;
    QNetworkAccessManager * qnam = new QNetworkAccessManager();
    QNetworkConfiguration activeConfig = qnam->activeConfiguration();

    switch (activeConfig.bearerType())
    {
        case QNetworkConfiguration::BearerEthernet:
        case QNetworkConfiguration::BearerWiMAX:
        case QNetworkConfiguration::BearerWLAN:
        case QNetworkConfiguration::BearerBluetooth:
            isWifi = true;
            break;
        default:
            isWifi = false;
            break;
    }

    return isWifi;
}

QString BangoStatic::ConnectionType(int connectionType)
{
    QString returnValue = "OTHER";

    if  (connectionType ==  BangoConstants::WIFI_CONNECTION){returnValue = "WIFI";}
    if  (connectionType ==  BangoConstants::OPERATOR_CONNECTION){returnValue = "OPERATOR";}

    return returnValue;
}

int BangoStatic::GetConnectionType()
{
    int connType = BangoConstants::UNKNOWN_CONNECTION;

    QNetworkAccessManager * qnam = new QNetworkAccessManager();
    QNetworkConfiguration activeConfig = qnam->activeConfiguration();

    switch (activeConfig.bearerType())
    {
        case QNetworkConfiguration::Bearer2G:
        case QNetworkConfiguration::BearerCDMA2000:
        case QNetworkConfiguration::BearerWCDMA:
        case QNetworkConfiguration::BearerHSPA:
            connType = BangoConstants::OPERATOR_CONNECTION;
            break;
        case QNetworkConfiguration::BearerEthernet:
        case QNetworkConfiguration::BearerWiMAX:
        case QNetworkConfiguration::BearerWLAN:
        case QNetworkConfiguration::BearerBluetooth:
            connType = BangoConstants::WIFI_CONNECTION;
            break;
        case QNetworkConfiguration::BearerUnknown:
            connType = BangoConstants::UNKNOWN_CONNECTION;
    }

    return connType;
}

QString BangoStatic::GetOperatorConnectionType()
{
    QString opConnType = BangoConstants::OPTION_OTHER;

    QNetworkAccessManager * qnam = new QNetworkAccessManager();
    QNetworkConfiguration activeConfig = qnam->activeConfiguration();

    switch (activeConfig.bearerType())
    {
        case QNetworkConfiguration::Bearer2G:
            opConnType = activeConfig.bearerName();
            break;
        case QNetworkConfiguration::BearerCDMA2000:
            opConnType = "CDMA";
            break;
        case QNetworkConfiguration::BearerWCDMA:
            opConnType = "UMTS";
            break;
        case QNetworkConfiguration::BearerHSPA:
            opConnType = "HSPA";
            break;
        case QNetworkConfiguration::BearerEthernet:
        case QNetworkConfiguration::BearerWiMAX:
        case QNetworkConfiguration::BearerWLAN:
        case QNetworkConfiguration::BearerBluetooth:
        case QNetworkConfiguration::BearerUnknown:
            opConnType = BangoConstants::OPTION_OTHER;
    }

    return opConnType;
}

QString BangoStatic::GetCountryISO(QString countryITU)
{
    QString returnString;

    // This conversion returns 0 for invalid numbers
    int intITU = countryITU.toInt();

    switch (intITU) {
        case 0:
            returnString = countryITU;
            break;
        case 202:
            returnString = "GRC";
            break;
        case 204:
            returnString = "NLD";
            break;
        case 206:
            returnString = "BEL";
            break;
        case 208:
            returnString = "FRA";
            break;
        case 212:
            returnString = "MCO";
            break;
        case 213:
            returnString = "AND";
            break;
        case 214:
            returnString = "ESP";
            break;
        case 216:
            returnString = "HUN";
            break;
        case 218:
            returnString = "BIH";
            break;
        case 219:
            returnString = "HRV";
            break;
        case 220:
            returnString = "SRB";
            break;
        case 222:
            returnString = "ITA";
            break;
        case 225:
            returnString = "VAT";
            break;
        case 226:
            returnString = "ROM";
            break;
        case 228:
            returnString = "CHE";
            break;
        case 230:
            returnString = "CZE";
            break;
        case 231:
            returnString = "SVK";
            break;
        case 232:
            returnString = "AUT";
            break;
        case 234:
        case 235:
            returnString = "GBR";
            break;
        case 238:
            returnString = "DNK";
            break;
        case 240:
            returnString = "SWE";
            break;
        case 242:
            returnString = "NOR";
            break;
        case 244:
            returnString = "FIN";
            break;
        case 246:
            returnString = "LTU";
            break;
        case 247:
            returnString = "LVA";
            break;
        case 248:
            returnString = "EST";
            break;
        case 250:
            returnString = "RUS";
            break;
        case 255:
            returnString = "UKR";
            break;
        case 257:
            returnString = "BLR";
            break;
        case 259:
            returnString = "MDA";
            break;
        case 260:
            returnString = "POL";
            break;
        case 262:
            returnString = "DEU";
            break;
        case 266:
            returnString = "GIB";
            break;
        case 268:
            returnString = "PRT";
            break;
        case 270:
            returnString = "LUX";
            break;
        case 272:
            returnString = "IRL";
            break;
        case 274:
            returnString = "ISL";
            break;
        case 276:
            returnString = "ALB";
            break;
        case 278:
            returnString = "MLT";
            break;
        case 280:
            returnString = "CYP";
            break;
        case 282:
            returnString = "GEO";
            break;
        case 283:
            returnString = "ARM";
            break;
        case 284:
            returnString = "BGR";
            break;
        case 286:
            returnString = "TUR";
            break;
        case 288:
            returnString = "FRO";
            break;
        case 290:
            returnString = "GRL";
            break;
        case 292:
            returnString = "SMR";
            break;
        case 293:
            returnString = "SVN";
            break;
        case 294:
            returnString = "MKD";
            break;
        case 295:
            returnString = "LIE";
            break;
    /*
     *     case 297: returnString = "ME"; break;
     */
        case 302:
            returnString = "CAN";
            break;
        case 308:
            returnString = "SPM";
            break;
        case 310:
        case 311:
        case 312:
        case 313:
        case 314:
        case 315:
        case 316:
            returnString = "USA";
            break;
        case 330:
            returnString = "PRI";
            break;
        case 332:
            returnString = "VIR";
            break;
        case 334:
            returnString = "MEX";
            break;
        case 338:
            returnString = "JAM";
            break;
    // 340 represents GLP (Guadaloupe) and MTQ (Martinique) - at
    // present, returns Guadaloupe.
        case 340:
            returnString = "GLP";
            break;
        case 342:
            returnString = "BRB";
            break;
        case 344:
            returnString = "ATG";
            break;
        case 346:
            returnString = "CYM";
            break;
        case 348:
            returnString = "VGB";
            break;
        case 350:
            returnString = "BMU";
            break;
        case 352:
            returnString = "GRD";
            break;
        case 354:
            returnString = "MSR";
            break;
        case 356:
            returnString = "KNA";
            break;
        case 358:
            returnString = "LCA";
            break;
        case 360:
            returnString = "VCT";
            break;
        case 362:
            returnString = "ANT";
            break;
        case 363:
            returnString = "ABW";
            break;
        case 364:
            returnString = "BHS";
            break;
        case 365:
            returnString = "AIA";
            break;
        case 366:
            returnString = "DMA";
            break;
        case 368:
            returnString = "CUB";
            break;
        case 370:
            returnString = "DOM";
            break;
        case 372:
            returnString = "HTI";
            break;
        case 374:
            returnString = "TTO";
            break;
        case 376:
            returnString = "TCA";
            break;
        case 400:
            returnString = "AZE";
            break;
        case 401:
            returnString = "KAZ";
            break;
        case 402:
            returnString = "BTN";
            break;
        case 404:
            returnString = "IND";
            break;
    /*
     *     case 405: returnString = "IN"; break;     case 406: returnString = "IN";
     * break;
     */
        case 410:
            returnString = "PAK";
            break;
        case 412:
            returnString = "AFG";
            break;
        case 413:
            returnString = "LKA";
            break;
        case 414:
            returnString = "MMR";
            break;
        case 415:
            returnString = "LBN";
            break;
        case 416:
            returnString = "JOR";
            break;
        case 417:
            returnString = "SYR";
            break;
        case 418:
            returnString = "IRQ";
            break;
        case 419:
            returnString = "KWT";
            break;
        case 420:
            returnString = "SAU";
            break;
        case 421:
            returnString = "YEM";
            break;
        case 422:
            returnString = "OMN";
            break;
    /*
     *     case 423: returnString = "PS"; break;
     */
        case 424:
            returnString = "ARE";
            break;
        case 425:
            returnString = "ISR";
            break;
        case 426:
            returnString = "BHR";
            break;
        case 427:
            returnString = "QAT";
            break;
        case 428:
            returnString = "MNG";
            break;
        case 429:
            returnString = "NPL";
            break;
        case 430:
        case 431:
            returnString = "ARE";
            break;
        case 432:
            returnString = "IRN";
            break;
        case 434:
            returnString = "UZB";
            break;
        case 436:
            returnString = "TJK";
            break;
        case 437:
            returnString = "KGZ";
            break;
        case 438:
            returnString = "TKM";
            break;
        case 440:
            ;
        case 441:
            returnString = "JPN";
            break;
        case 450:
            returnString = "KOR";
            break;
        case 452:
            returnString = "VNM";
            break;
        case 454:
            returnString = "HKG";
            break;
        case 455:
            returnString = "MAC";
            break;
        case 456:
            returnString = "KHM";
            break;
        case 457:
            returnString = "LAO";
            break;
        case 460:
            ;
        case 461:
            returnString = "CHN";
            break;
        case 466:
            returnString = "TWN";
            break;
        case 467:
            returnString = "PRK";
            break;
        case 470:
            returnString = "BGD";
            break;
        case 472:
            returnString = "MDV";
            break;
        case 502:
            returnString = "MYS";
            break;
        case 505:
            returnString = "AUS";
            break;
        case 510:
            returnString = "IDN";
            break;
        case 514:
            returnString = "TMP";
            break;
        case 515:
            returnString = "PHL";
            break;
        case 520:
            returnString = "THA";
            break;
        case 525:
            returnString = "SGP";
            break;
        case 528:
            returnString = "BRN";
            break;
        case 530:
            returnString = "NZL";
            break;
        case 534:
            returnString = "MNP";
            break;
        case 535:
            returnString = "GUM";
            break;
        case 536:
            returnString = "NRU";
            break;
        case 537:
            returnString = "PNG";
            break;
        case 539:
            returnString = "TON";
            break;
        case 540:
            returnString = "SLB";
            break;
        case 541:
            returnString = "VUT";
            break;
        case 542:
            returnString = "FJI";
            break;
        case 543:
            returnString = "WLF";
            break;
        case 544:
            returnString = "ASM";
            break;
        case 545:
            returnString = "KIR";
            break;
        case 546:
            returnString = "NCL";
            break;
        case 547:
            returnString = "PYF";
            break;
        case 548:
            returnString = "COK";
            break;
        case 549:
            returnString = "WSM";
            break;
        case 550:
            returnString = "FSM";
            break;
        case 551:
            returnString = "MHL";
            break;
        case 552:
            returnString = "PLW";
            break;
        case 602:
            returnString = "EGY";
            break;
        case 603:
            returnString = "DZA";
            break;
        case 604:
            returnString = "MAR";
            break;
        case 605:
            returnString = "TUN";
            break;
        case 606:
            returnString = "LBY";
            break;
        case 607:
            returnString = "GMB";
            break;
        case 608:
            returnString = "SEN";
            break;
        case 609:
            returnString = "MRT";
            break;
        case 610:
            returnString = "MLI";
            break;
        case 611:
            returnString = "GIN";
            break;
        case 612:
            returnString = "CIV";
            break;
        case 613:
            returnString = "BFA";
            break;
        case 614:
            returnString = "NER";
            break;
        case 615:
            returnString = "TGO";
            break;
        case 616:
            returnString = "BEN";
            break;
        case 617:
            returnString = "MUS";
            break;
        case 618:
            returnString = "LBR";
            break;
        case 619:
            returnString = "SLE";
            break;
        case 620:
            returnString = "GHA";
            break;
        case 621:
            returnString = "NGA";
            break;
        case 622:
            returnString = "TCD";
            break;
        case 623:
            returnString = "CAF";
            break;
        case 624:
            returnString = "CMR";
            break;
        case 625:
            returnString = "CPV";
            break;
        case 626:
            returnString = "STP";
            break;
        case 627:
            returnString = "GNQ";
            break;
        case 628:
            returnString = "GAB";
            break;
        case 629:
            returnString = "COG";
            break;
        case 630:
            returnString = "COD";
            break;
        case 631:
            returnString = "AGO";
            break;
        case 632:
            returnString = "GNB";
            break;
        case 633:
            returnString = "SYC";
            break;
        case 634:
            returnString = "SDN";
            break;
        case 635:
            returnString = "RWA";
            break;
        case 636:
            returnString = "ETH";
            break;
        case 637:
            returnString = "SOM";
            break;
        case 638:
            returnString = "DJI";
            break;
        case 639:
            returnString = "KEN";
            break;
        case 640:
            returnString = "TZA";
            break;
        case 641:
            returnString = "UGA";
            break;
        case 642:
            returnString = "BDI";
            break;
        case 643:
            returnString = "MOZ";
            break;
        case 645:
            returnString = "ZMB";
            break;
        case 646:
            returnString = "MDG";
            break;
        case 647:
            returnString = "REU";
            break;
        case 648:
            returnString = "ZWE";
            break;
        case 649:
            returnString = "NAM";
            break;
        case 650:
            returnString = "MWI";
            break;
        case 651:
            returnString = "LSO";
            break;
        case 652:
            returnString = "BWA";
            break;
        case 653:
            returnString = "SWZ";
            break;
        case 654:
            returnString = "COM";
            break;
        case 655:
            returnString = "ZAF";
            break;
        case 657:
            returnString = "ERI";
            break;
        case 702:
            returnString = "BLZ";
            break;
        case 704:
            returnString = "GTM";
            break;
        case 706:
            returnString = "SLV";
            break;
        case 708:
            returnString = "HND";
            break;
        case 710:
            returnString = "NIC";
            break;
        case 712:
            returnString = "CRI";
            break;
        case 714:
            returnString = "PAN";
            break;
        case 716:
            returnString = "PER";
            break;
        case 722:
            returnString = "ARG";
            break;
        case 724:
            returnString = "BRA";
            break;
        case 730:
            returnString = "CHL";
            break;
        case 732:
            returnString = "COL";
            break;
        case 734:
            returnString = "VEN";
            break;
        case 736:
            returnString = "BOL";
            break;
        case 738:
            returnString = "GUY";
            break;
        case 740:
            returnString = "ECU";
            break;
        case 742:
            returnString = "GUF";
            break;
        case 744:
            returnString = "PRY";
            break;
        case 746:
            returnString = "SUR";
            break;
        case 748:
            returnString = "URY";
            break;
        /*
         * case 750: returnString = "FK"; break;
         */
        default:
            returnString = "";
            break;
        }

    return returnString;


}

